package com.turman.demo.fragment

import android.os.Handler
import android.os.Looper
import com.turman.builibrary.refresh.BRefresh
import com.turman.builibrary.refresh.BRefreshLayout
import com.turman.common.ui.component.BaseFragment
import com.turman.demo.BLottieOverView
import com.turman.demo.R

class CategoryFragment:BaseFragment() {
    override fun getLayoutId(): Int = R.layout.frg_category

    override fun init() {
        val refreshLayout = layoutView.findViewById<BRefreshLayout>(R.id.refresh_layout)
        context?.let {
            val overView = BLottieOverView(it)
            refreshLayout.setRefreshListener(object : BRefresh.BRefreshListener {
                override fun onRefresh() {
                    Handler(Looper.getMainLooper()).postDelayed({
                        refreshLayout.refreshFinished()
                    }, 2000)
                }

                override fun enableRefresh(): Boolean {
                    return true
                }

            })
            refreshLayout.setRefreshOverview(overView)
        }
    }
}